<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <link rel="icon" href="/logo.svg">
  <title>管道装备制造质量管控系统</title>
  <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
  <!-- Load TinyMCE first to ensure it's available -->
  <script src="https://cdn.jsdelivr.net/npm/tinymce@6.7.0/tinymce.min.js"></script>
  <script src="/tinymce/plugins/paste/plugin.min.js"></script>
  <script src="/tinymce/plugins/print/plugin.min.js"></script>
  <!-- Load our custom plugins -->
  <script src="/WordPaster/js/w.js"></script>
  <script src="/zyCapture/z.js"></script>
  <script src="/zyOffice/js/z.js"></script>
  <script>
    // 确保TinyMCE插件能够被正确注册
    window.onload = function() {
      // 添加图片加载调试
      function debugImageLoading() {
        console.log('检查图片加载情况');
        const iconPaths = [
          '/WordPaster/plugin/word1.png',
          '/WordPaster/plugin/word2.png',
          '/WordPaster/plugin/net.png',
          '/WordPaster/plugin/excel.png',
          '/WordPaster/plugin/ppt.png',
          '/WordPaster/plugin/pdf.png',
          '/zyCapture/z.png',
          '/zyOffice/plugin/w.png'
        ];
        
        iconPaths.forEach(path => {
          const img = new Image();
          img.onload = () => console.log(`图片加载成功: ${path}`);
          img.onerror = () => console.error(`图片加载失败: ${path}`);
          img.src = window.location.origin + path;
        });
      }
      
      // 页面加载完成后检查图片
      setTimeout(debugImageLoading, 2000);
      
      if (window.tinymce && window.tinymce.PluginManager) {
        console.log('TinyMCE plugins are being registered');
        
        // 确保基础插件正确注册
        if (!window.tinymce.PluginManager.get('wordpaster') && window.WordPaster) {
          window.tinymce.PluginManager.add('wordpaster', function(editor) {
            editor.ui.registry.addButton('wordpaster', {
              icon: 'paste-text',
              tooltip: 'Word粘贴',
              onAction: function() {
                if (window.WordPaster && window.WordPaster.getInstance) {
                  var wordPaster = window.WordPaster.getInstance();
                  if (typeof wordPaster.uploadWord === 'function') {
                    wordPaster.uploadWord();
                  }
                }
              }
            });
            return {};
          });
        }
        
        if (!window.tinymce.PluginManager.get('zycapture') && window.zyCapture) {
          window.tinymce.PluginManager.add('zycapture', function(editor) {
            editor.ui.registry.addButton('zycapture', {
              icon: 'image',
              tooltip: '截图',
              onAction: function() {
                if (window.zyCapture && window.zyCapture.getInstance) {
                  var capture = window.zyCapture.getInstance();
                  if (typeof capture.capture === 'function') {
                    capture.capture();
                  }
                }
              }
            });
            return {};
          });
        }
        
        if (!window.tinymce.PluginManager.get('zyoffice') && window.zyOffice) {
          window.tinymce.PluginManager.add('zyoffice', function(editor) {
            editor.ui.registry.addButton('zyoffice', {
              icon: 'document-properties',
              tooltip: 'Office文档',
              onAction: function() {
                if (window.zyOffice && window.zyOffice.getInstance) {
                  var office = window.zyOffice.getInstance();
                  if (typeof office.openDoc === 'function') {
                    office.openDoc();
                  }
                }
              }
            });
            return {};
          });
        }
        
        // 添加其他文档插件
        if (!window.tinymce.PluginManager.get('importwordtoimg')) {
          window.tinymce.PluginManager.add('importwordtoimg', function(editor) {
            editor.ui.registry.addButton('importwordtoimg', {
              icon: 'document-properties',
              tooltip: 'Word转图片',
              onAction: function() {
                if (window.WordPaster && window.WordPaster.getInstance) {
                  var wordPaster = window.WordPaster.getInstance();
                  if (typeof wordPaster.importWordToImg === 'function') {
                    wordPaster.importWordToImg();
                  }
                }
              }
            });
            return {};
          });
        }
        
        if (!window.tinymce.PluginManager.get('netpaster')) {
          window.tinymce.PluginManager.add('netpaster', function(editor) {
            editor.ui.registry.addButton('netpaster', {
              icon: 'embed',
              tooltip: '网络图片',
              onAction: function() {
                if (window.WordPaster && window.WordPaster.getInstance) {
                  var wordPaster = window.WordPaster.getInstance();
                  if (typeof wordPaster.UploadNetImg === 'function') {
                    wordPaster.UploadNetImg();
                  }
                }
              }
            });
            return {};
          });
        }
        
        if (!window.tinymce.PluginManager.get('wordimport')) {
          window.tinymce.PluginManager.add('wordimport', function(editor) {
            editor.ui.registry.addButton('wordimport', {
              icon: 'new-document',
              tooltip: '导入Word',
              onAction: function() {
                if (window.zyOffice && window.zyOffice.getInstance) {
                  var office = window.zyOffice.getInstance();
                  if (typeof office.openDoc === 'function') {
                    office.openDoc();
                  }
                }
              }
            });
            return {};
          });
        }
        
        if (!window.tinymce.PluginManager.get('excelimport')) {
          window.tinymce.PluginManager.add('excelimport', function(editor) {
            editor.ui.registry.addButton('excelimport', {
              icon: 'table',
              tooltip: '导入Excel',
              onAction: function() {
                if (window.zyOffice && window.zyOffice.getInstance) {
                  var office = window.zyOffice.getInstance();
                  if (typeof office.openDoc === 'function') {
                    alert('请选择Excel文件');
                    office.openDoc();
                  }
                }
              }
            });
            return {};
          });
        }
        
        if (!window.tinymce.PluginManager.get('pptimport')) {
          window.tinymce.PluginManager.add('pptimport', function(editor) {
            editor.ui.registry.addButton('pptimport', {
              icon: 'user',
              tooltip: '导入PPT',
              onAction: function() {
                if (window.zyOffice && window.zyOffice.getInstance) {
                  var office = window.zyOffice.getInstance();
                  if (typeof office.openDoc === 'function') {
                    alert('请选择PPT文件');
                    office.openDoc();
                  }
                }
              }
            });
            return {};
          });
        }
        
        if (!window.tinymce.PluginManager.get('pdfimport')) {
          window.tinymce.PluginManager.add('pdfimport', function(editor) {
            editor.ui.registry.addButton('pdfimport', {
              icon: 'sourcecode',
              tooltip: '导入PDF',
              onAction: function() {
                if (window.zyOffice && window.zyOffice.getInstance) {
                  var office = window.zyOffice.getInstance();
                  if (typeof office.openPdf === 'function') {
                    office.openPdf();
                  }
                }
              }
            });
            return {};
          });
        }
      }
    };
  </script>
  <style>
    html,
    body,
    #app {
      height: 100%;
      margin: 0px;
      padding: 0px;
    }

    .chromeframe {
      margin: 0.2em 0;
      background: #ccc;
      color: #000;
      padding: 0.2em 0;
    }

    #loader-wrapper {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 999999;
    }

    #loader {
      display: block;
      position: relative;
      left: 50%;
      top: 50%;
      width: 150px;
      height: 150px;
      margin: -75px 0 0 -75px;
      border-radius: 50%;
      border: 3px solid transparent;
      border-top-color: #FFF;
      -webkit-animation: spin 2s linear infinite;
      -ms-animation: spin 2s linear infinite;
      -moz-animation: spin 2s linear infinite;
      -o-animation: spin 2s linear infinite;
      animation: spin 2s linear infinite;
      z-index: 1001;
    }

    #loader:before {
      content: "";
      position: absolute;
      top: 5px;
      left: 5px;
      right: 5px;
      bottom: 5px;
      border-radius: 50%;
      border: 3px solid transparent;
      border-top-color: #FFF;
      -webkit-animation: spin 3s linear infinite;
      -moz-animation: spin 3s linear infinite;
      -o-animation: spin 3s linear infinite;
      -ms-animation: spin 3s linear infinite;
      animation: spin 3s linear infinite;
    }

    #loader:after {
      content: "";
      position: absolute;
      top: 15px;
      left: 15px;
      right: 15px;
      bottom: 15px;
      border-radius: 50%;
      border: 3px solid transparent;
      border-top-color: #FFF;
      -moz-animation: spin 1.5s linear infinite;
      -o-animation: spin 1.5s linear infinite;
      -ms-animation: spin 1.5s linear infinite;
      -webkit-animation: spin 1.5s linear infinite;
      animation: spin 1.5s linear infinite;
    }


    @-webkit-keyframes spin {
      0% {
        -webkit-transform: rotate(0deg);
        -ms-transform: rotate(0deg);
        transform: rotate(0deg);
      }

      100% {
        -webkit-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
        transform: rotate(360deg);
      }
    }

    @keyframes spin {
      0% {
        -webkit-transform: rotate(0deg);
        -ms-transform: rotate(0deg);
        transform: rotate(0deg);
      }

      100% {
        -webkit-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
        transform: rotate(360deg);
      }
    }


    #loader-wrapper .loader-section {
      position: fixed;
      top: 0;
      width: 51%;
      height: 100%;
      background: #7171C6;
      z-index: 1000;
      -webkit-transform: translateX(0);
      -ms-transform: translateX(0);
      transform: translateX(0);
    }

    #loader-wrapper .loader-section.section-left {
      left: 0;
    }

    #loader-wrapper .loader-section.section-right {
      right: 0;
    }


    .loaded #loader-wrapper .loader-section.section-left {
      -webkit-transform: translateX(-100%);
      -ms-transform: translateX(-100%);
      transform: translateX(-100%);
      -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
      transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
    }

    .loaded #loader-wrapper .loader-section.section-right {
      -webkit-transform: translateX(100%);
      -ms-transform: translateX(100%);
      transform: translateX(100%);
      -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
      transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
    }

    .loaded #loader {
      opacity: 0;
      -webkit-transition: all 0.3s ease-out;
      transition: all 0.3s ease-out;
    }

    .loaded #loader-wrapper {
      visibility: hidden;
      -webkit-transform: translateY(-100%);
      -ms-transform: translateY(-100%);
      transform: translateY(-100%);
      -webkit-transition: all 0.3s 1s ease-out;
      transition: all 0.3s 1s ease-out;
    }

    .no-js #loader-wrapper {
      display: none;
    }

    .no-js h1 {
      color: #222222;
    }

    #loader-wrapper .load_title {
      font-family: 'Open Sans';
      color: #FFF;
      font-size: 19px;
      width: 100%;
      text-align: center;
      z-index: 9999999999999;
      position: absolute;
      top: 60%;
      opacity: 1;
      line-height: 30px;
    }

    #loader-wrapper .load_title span {
      font-weight: normal;
      font-style: italic;
      font-size: 13px;
      color: #FFF;
      opacity: 0.5;
    }

    /* 自定义TinyMCE图标样式 */
    /* 隐藏SVG图标，显示自定义图片 */
    .tox .tox-tbtn[aria-label="Word粘贴"] .tox-icon svg,
    .tox .tox-tbtn[aria-label="Word转图片"] .tox-icon svg,
    .tox .tox-tbtn[aria-label="网络图片"] .tox-icon svg,
    .tox .tox-tbtn[aria-label="导入Excel"] .tox-icon svg,
    .tox .tox-tbtn[aria-label="导入PPT"] .tox-icon svg,
    .tox .tox-tbtn[aria-label="导入PDF"] .tox-icon svg,
    .tox .tox-tbtn[aria-label="截图"] .tox-icon svg,
    .tox .tox-tbtn[aria-label="Office文档"] .tox-icon svg {
      display: none;
    }
    
    /* 确保图片图标正确显示 */
    .tox .tox-tbtn .tox-icon img {
      width: 20px !important;  /* 增加大小 */
      height: 20px !important;
      vertical-align: middle;
      opacity: 1 !important;
      visibility: visible !important;
    }

    /* 强制显示图片图标 */
    .tox .tox-toolbar__group .tox-tbtn img {
      display: block !important;
    }
  </style>
</head>

<body>
  <div id="app">
    <div id="loader-wrapper">
      <div id="loader"></div>
      <div class="loader-section section-left"></div>
      <div class="loader-section section-right"></div>
      <div class="load_title">正在加载系统资源，请耐心等待</div>
    </div>
  </div>
  <script type="module" src="/src/main.js"></script>
</body>

</html>